using System;
using System.Collections.Generic;
using System.Text;
using DAL;
using Utility;
using DTO;

namespace BUS
{
   public class tbtinhtrangdonhangBUS
    {
       public static tbtinhtrangdonhangcollection Get(string where,
       int pageindex,
       int pagesize,
       string orderby,
       string orderdirection,
       out int total)
        {
            tbtinhtrangdonhangDAL tinhtrangdonhangDAL = new tbtinhtrangdonhangDAL();
            return tinhtrangdonhangDAL.Get(where, pageindex, pagesize, orderby, orderdirection, out total);
        }
       public static tbtinhtrangdonhangcollection GetAll()
        {
            int total = 0;
            Criteria cri = new Criteria();
            tbtinhtrangdonhangDAL tinhtrangdonhangDAL = new tbtinhtrangdonhangDAL();
            return tinhtrangdonhangDAL.Get(cri.Criter, 0, 0, tinhtrangdonhangcolumns.matinhtrang.ToString(), OrderDirection.ASC.ToString(), out total);
        }
       public static tbtinhtrangdonhang GetByID(int iD)
        {
            int total = 0;
            Criteria cri = new Criteria();
            cri.add(Condition.AND, tinhtrangdonhangcolumns.matinhtrang.ToString(), Condition.EQUAL, iD);
            tbtinhtrangdonhangDAL tinhtrangdonhangDAL = new tbtinhtrangdonhangDAL();
            tbtinhtrangdonhangcollection tinhtrangdonhangcollection = tinhtrangdonhangDAL.Get(cri.Criter,
                     0, 0, tinhtrangdonhangcolumns.matinhtrang.ToString(), OrderDirection.ASC.ToString(), out total);
            if (tinhtrangdonhangcollection.Count > 0)
                return tinhtrangdonhangcollection[0];
            return null;
        }
    }
}
